﻿using BLL.Basis;
using Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebProject.Controllers
{
    public class CommonController : Controller
    {
        //
        // GET: /Common/
        public ActionResult selectProductType()
        {
            return View();
        }
        public ActionResult selectProduct()
        {
            return View();
        }
        public ActionResult selectCommonData()
        {
            return View();
        }
        public ActionResult selectCustomer()
        {
            return View();
        }
        public ActionResult selectBanGun()
        {
            return View();
        }
        public ActionResult selectYangBan()
        {
            return View();
        }
        public ActionResult selectGongXu()
        {
            return View();
        }
        public ActionResult SelectPlanStatus()
        {
            return View();
        }
        public ActionResult SelectUserPosition()
        {
            return View();
        }
        /// <summary>
        /// 完整的存货选择(带存货分类)
        /// </summary>
        /// <returns></returns>
        public ActionResult selectCompleteProduct()
        {
            return View();
        }
        public ActionResult selectUser()
        {
            return View();
        }
        public ActionResult selectSaler()
        {
            return View();
        }
        /// <summary>
        /// 其他绩效选择
        /// </summary>
        /// <returns></returns>
        public ActionResult selectOther()
        {
            return View();
        }
        
        public ActionResult selectWareHouse()
        {
            return View();
        }
        public ActionResult selectGY()
        {
            return View();
        }
        public ActionResult selectInvproperty()
        {
            return View();
        }

        [HttpGet]
        public JsonResult GetDataList(string page, string limit, string condition, string dataType)
        {
            var rsl = new ReturnResult();
            string pageCount = "1";
            string msg = "";
            var datas = new object();
            if (dataType == "user")
            {
                SysFrameWork.UserBLL uBLL = new SysFrameWork.UserBLL();
                rsl = uBLL.AllUserList(condition);
            }
            if (dataType == "saler")//获取U8 Person表
            {
                BaseDataBLL baseBLL = new BaseDataBLL();
                rsl = baseBLL.AllPeoPleList(condition);
            }
            else if (dataType == "gx")
            {
                BLL.Basis.BaseDataBLL baseBLL = new BLL.Basis.BaseDataBLL();
                rsl = baseBLL.GetCommonData(condition);
            }
            else if (dataType == "csl")
            {
                BLL.Basis.BaseDataBLL baseBLL = new BLL.Basis.BaseDataBLL();
                rsl = baseBLL.loadPlanStatus(condition);
            }
            else if (dataType == "upi")
            {
                BLL.Basis.BaseDataBLL baseBLL = new BLL.Basis.BaseDataBLL();
                rsl = baseBLL.getUserPositionByGX(condition);
            }
            if (rsl.Result)
            {
                datas = rsl.Data;
            }
            else
            {
                msg = rsl.Message;
            }
            return new JsonResult()
            {
                Data = new
                {
                    count = pageCount,
                    msg = msg,
                    code = "0",
                    data = datas
                },
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
	}
}